package com.criticalritrpg;

import com.RPGDice.RollMain;
import com.criticalritrpg.ajuda.ajudaActivity;
import com.criticalritrpg.conexoes.BluetoothChat;
import com.criticalritrpg.fichas.TabWidgetFichaActivity;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.Button;

public class CriticalHit extends Activity implements OnClickListener {

	Button bt_criaJogo, bt_dados, bt_help, bt_exit, bt_verJogos, bt_CriarFichas;
	public static final int TAB_JOGADOR = 1;  

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.app_main);

		//bt_criaJogo = (Button) findViewById(R.id.button_criarJogo);
		//bt_criaJogo.setOnClickListener(this);

		bt_dados = (Button) findViewById(R.id.button_dados);
		bt_dados.setOnClickListener(this);

		bt_help = (Button) findViewById(R.id.button_help);
		bt_help.setOnClickListener(this);

		bt_exit = (Button) findViewById(R.id.button_sair);
		bt_exit.setOnClickListener(this);
		
		bt_verJogos = (Button) findViewById(R.id.button_verJogos);
		bt_verJogos.setOnClickListener(this);
		
		bt_CriarFichas = (Button) findViewById(R.id.bt_criar_fichas);
		bt_CriarFichas.setOnClickListener(this);

	}

	public void onClick(View v) {
		Intent mIntent;
		switch (v.getId()) {
		/*
		case R.id.button_criarJogo:
			mIntent = new Intent(getApplicationContext(),
					AddJogadores.class);
			startActivity(mIntent);
			break; */
		
		case R.id.bt_criar_fichas:
			mIntent = new Intent(getApplicationContext(),
					TabWidgetFichaActivity.class);
			mIntent.addFlags(0);
			startActivity(mIntent);
			break;
		
		case R.id.button_dados:
			mIntent = new Intent(getApplicationContext(),
					RollMain.class);
			startActivity(mIntent);
			break; 
		case R.id.button_verJogos:
			mIntent = new Intent(getApplicationContext(),
					VerJogosActivity.class);
			startActivity(mIntent);
			break;
		case R.id.button_help:
			mIntent = new Intent(getApplicationContext(),
					ajudaActivity.class);
			startActivity(mIntent);
			break;
		case R.id.button_sair:
			askForExit();
			break;
		}

	}
	/*
	private void showHelpDialog(){
		AlertDialog.Builder builder = new AlertDialog.Builder(this);
		builder.setMessage(R.string.help_text)
		       .setCancelable(true);
		AlertDialog alert = builder.create();
		alert.show();
	}
	*/

	private void askForExit() {
		AlertDialog.Builder builder = new AlertDialog.Builder(this);
		builder.setMessage(R.string.exit_message)
				.setCancelable(false)
				.setPositiveButton(R.string.yes,
						new DialogInterface.OnClickListener() {
							public void onClick(DialogInterface dialog, int id) {
								CriticalHit.this.finish();
							}
						})
				.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
					public void onClick(DialogInterface dialog, int id) {
						dialog.cancel();
					}
				});
		AlertDialog alert = builder.create();
		alert.show();
	}
	
}